package com.example.gzysmartcity.ui.adapter;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.example.gzysmartcity.R;
import com.example.gzysmartcity.repository.model.MyCityBus;

import org.jetbrains.annotations.NotNull;

public class BusListAdapter extends BaseQuickAdapter<MyCityBus, BaseViewHolder> {
    public BusListAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, MyCityBus cityBus) {
        ImageView imageView = baseViewHolder.getView(R.id.image_rv_buslist);
        Glide.with(getContext()).load(R.mipmap.bus).into(imageView);
        baseViewHolder.setText(R.id.tv_rv_busname, "车辆名称: " + cityBus.getBusName());
        baseViewHolder.setText(R.id.tv_rv_busnow, "当前站点: " + cityBus.getNow());
        if (cityBus.getNext() != null)
            baseViewHolder.setText(R.id.tv_rv_busnext, "下一站: " + cityBus.getNext());
        else
            baseViewHolder.setText(R.id.tv_rv_busnext, "");
    }
}
